using System;
using System.Reflection;

namespace UnitTesting.Fixturing
{
	class ConditionalConstructorSelector<T> : ConstructorSelectorBase<T>
	{
		readonly Func<ConstructorInfo[], ConstructorInfo> _condition;

		internal Func<ConstructorInfo[], ConstructorInfo> Condition
		{
			get { return _condition; }
		}

		internal ConditionalConstructorSelector(Func<ConstructorInfo[], ConstructorInfo> condition)
		{
			_condition = condition;
		}

		protected internal override ConstructorInfo Select(ConstructorInfo[] constructors)
		{
			return _condition(constructors);
		}
	}
}